import request from '@/utils/request'

// 员工相关
// 获取员工列表
export const getEmployeesListApi = (page, size) => {
  return request({
    url: '/sys/user',
    params: {
      page,
      size
    }
  })
}

// 删除员工
export const delEmployeeApi = (id) => {
  return request.delete(`/sys/user/${id}`)
}

// 添加员工
export const addEmployeeApi = (data) => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

// 批量导入excel表格员工列表
export const batchAddEmployeeApi = arr => {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data: arr
  })
}

// 修改员工
export const saveUserDetailByIdApi = (data) => {
  return request(
    { url: `/sys/user/${data.id}`,
      method: 'PUT',
      data }
  )
}

/** *
 * 给员工分配角色
 * ***/
export function assignRolesApi(data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
